<%-- 
    Document   : CarBook
    Created on : Nov 1, 2011, 11:25:36 PM
    Author     : MrKoi
--%>

<%@page import="DAL.CarBean"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page session="true" import="java.util.Collection" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/taglib139.tld" prefix="pg" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>East2West Tours and Travels</title>
        <script src="js/datetimepicker_css.js"></script>
        <script src="js/gen_validatorv4.js" type="text/javascript"></script>
        <style type="text/css">
                .khun
                {
                    background-color:#dfe0dd;
                    width:500px;
                    margin-left:auto;
                    margin-right:auto;
                    margin-top:15px;
                }
                table
                {
                margin-left:auto;
                margin-right:auto;
                }
                .font
                {
                font-family:"Times New Roman", Times, serif;
                font-size:x-large;
                font-weight:bold;
                width:200px;
                height:30px;
                margin-left:auto;
                margin-right:auto;
                color:#0707e7;
                }
                 .font1
                {
                font-family:"Times New Roman", Times, serif;
                font-size:large;
                font-weight:bold;
                width:560px;
                height:30px;
                margin-left:auto;
                margin-right:auto;
                margin-top:10px;
                color:#0707e7;
                }
                .noidung
                {
                font-family:"Times New Roman", Times, serif;
                color:black;
                font-size:medium;
                font-weight:bold;
                }
                .sizib
                {
                width:120px;
                }
                .khunthongbao
                {
                margin-left:auto;
                margin-right:auto;
                width:450px;
                height:120px;
                margin-top:50px;
                background-color:#e8f0dc;
                border:2px solid #84b788;
                }
        </style>
    </head>
    <body>
    <%
        String id="",username=""; 
        if(session.getAttribute("User")!=null)
            {
            if(request.getParameter("id")!=null)
                {
                    id=request.getParameter("id");
                    username=session.getAttribute("User").toString();
                    CarBean cb=new CarBean();
                    Collection coll=cb.SeclectCarBookID(id);
                    request.setAttribute("carb",coll);
                    
                    int quantity=cb.getquantity(id);
                    if(quantity !=0)
                        {
                %>
                
            
        <div class="khun">
            <div class="font">Car Rental</div>           
              <form id="commentForm" action="ControllerCarBook" method="get" name="mm" enctype="multipart/form-data" >
                <table border="0" cellpadding="3" cellspacing="3" width="500px"> 
                        <tr>
                            <td colspan="3" height="20px"></td>
                        </tr>
                        <tr>
                        <td width="30px"><input type="hidden" name="username" value="<%=username%>" /></td>
                        <td width="180px"><input type="hidden" name="carid" value="<%=id%>" /></td>
                        <td></td>
                    </tr>
                    <c:forEach items="${carb}" var="cbid" >
                        <tr>
                            <td>Name Car: </td>
                            <td>${cbid.carName}</td>
                            <td></td>
                        </tr>
                        <tr>
                            <td>Image:</td>
                            <td><img src="${cbid.image}" border="1" alt="${cbid.carName}" width="100px" height="100px"/></td>
                            <td></td>
                        </tr>
                    </c:forEach>
                    <tr>
                        <td colspan="3"><hr></td>
                    </tr>
                    <tr>
                        <td colspan="2" class="noidung">Input Information Car Rental</td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>Driver:</td>
                        <td>
                            <input type="radio" name="driver" value="Yes" checked="True" />Yes
                            <input type="radio" name="driver" value="No" />No
                        </td>
                        <td></td>
                    </tr>
                    <tr>
                        <td width="130px">Pick Up Date:</td>
                        <td style="color:black;font-weight:boid;">
                            <input type="Text" id="demo1" name="PickUpDate" maxlength="25" size="20" readonly="True"/>
                            <img src="images/cal.gif" width="20px" height="20px" onclick="javascript:NewCssCal('demo1','ddMMyyyy')" style="cursor:pointer"/>
                        </td>
                        <td style="color:red;"><div id='commentForm_PickUpDate_errorloc' class="error_strings"></div></td>
                    </tr>
                    <tr>
                        <td>Drop Off Date</td>
                        <td valign="bottom" style="color:red;">                        
                            <input type="Text" id="demo2" name="DropOffDate" maxlength="25" size="20" readonly="True" />
                            <img align="bottom" src="images/cal.gif" width="20px" height="20px" onclick="javascript:NewCssCal('demo2','ddMMyyyy')" style="cursor:pointer"/>
                        </td> 
                        <td style="color:red;"><div id='commentForm_DropOffDate_errorloc' class="error_strings"></div></td>
                    </tr>
                    <tr>
                        <td>Type Package:</td>
                        <td>
                            <input type="radio" name="package" value="Day" checked="True" />Day
                            <input type="radio" name="package" value="Hour" />Hour
                            <input type="radio" name="package" value="kilomet" />Km
                        </td>
                    </tr>
                    <tr>
                        <td>Time Rent:<br>.</td>
                        <td style="color:red;"><input type="text" name="songay" maxlength="10" size="20" /> Day|Hour|Km</td>
                        <td style="color:red;"><div id='commentForm_songay_errorloc' class="error_strings"></div></td>
                    </tr>
                    <tr>
                        <td colspan="3"><hr></td>
                    </tr>
                    <tr>
                        <td align="center" colspan="2"><input type="submit" class="sizib" name="booking" value="Rental" /><input type="reset" class="sizib" value="Reset" /></td>
                        <td></td>
                </tr>
                </table>
             </form>
                    
             <script language="JavaScript" type="text/javascript">
                var frmvalidator = new Validator("commentForm");
                frmvalidator.EnableOnPageErrorDisplay();
                frmvalidator.EnableMsgsTogether();            

                frmvalidator.addValidation("PickUpDate","req","*");
                
                frmvalidator.addValidation("DropOffDate","req","*");
               
                frmvalidator.addValidation("songay","req","*");
                frmvalidator.addValidation("songay","numeric","Please enter only digits");
                
         </script>
        </div>
         <%
                }
                else
                    {
                        %>
                     <div class="khunthongbao">
                         <div class="font">Notice</div>
                        <table>
                            <tr>
                                <td align="center"></td>
                            </tr>
                            <tr>
                                <td>
                                 <div class="font1">Current car has been leased. please choose a car other</div> 
                                </td>
                            </tr>
                        </table>
                    </div>
                        <%
                    }
              }
            }
           else
            {
                %>
                <jsp:include page="Login.jsp" flush="True" />
                <%
            }
    %>
    </body>
</html>
